package com.hanoiwiki.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "USER")
public class User extends BaseObject{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	
	@Column(name="USER_NAME", unique=true)
	private String userName;
	
	@Column(name="PASSWORD")
	@Transient
	private String password;
	
	@Column(name="RIGHT")
	private String right;
	
	@Column(name="DESCRIPTION")
	private String description;
	
	@Column(name="STATUS")
	private Integer status;
	
	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)	
	private UserEvaluation userEvaluation;
	
	@OneToMany(mappedBy="user", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private List<UserStatistic> userStatistic;
	
	@OneToMany(mappedBy="user", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private List<UserLog> userLog;
	
	public UserEvaluation getUserEvaluation() {
		return userEvaluation;
	}
	public void setUserEvaluation(UserEvaluation userEvaluation) {
		this.userEvaluation = userEvaluation;
	}
	public List<UserStatistic> getUserStatistic() {
		return userStatistic;
	}
	public void setUserStatistic(List<UserStatistic> userStatistic) {
		this.userStatistic = userStatistic;
	}	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getRight() {
		return right;
	}
	public void setRight(String right) {
		this.right = right;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public List<UserLog> getUserLog() {
		return userLog;
	}
	public void setUserLog(List<UserLog> userLog) {
		this.userLog = userLog;
	}
	
	
}
